<script src="//unpkg.com/vue@2/dist/vue.js"></script>
<script src="//unpkg.com/element-ui@2.15.13/lib/index.js"></script>
<div id="app">
<el-tree :data="data"
         :props="defaultProps"
         check-strictly
         @node-click="handleNodeClick"></el-tree>
</div>

<script>
var Main = {
data() {
return {
data: [{
id:'1',
label: '一级 1',
children: [{
id:'2',
label: '二级 1-1',
children: [{
id:'3',
label: '三级 1-1-1'
}]
}]
}, {
id:'4',
label: '一级 2',
children: [{
id:'5',
label: '二级 2-1',
children: [{
id:'6',
label: '三级 2-1-1'
}]
}, {
id:'7',
label: '二级 2-2',
children: [{
id:'8',
label: '三级 2-2-1'
}]
}]
}, {
id:'9',
label: '一级 3',
children: [{
id:'10',
label: '二级 3-1',
children: [{
id:'11',
label: '三级 3-1-1'
}]
}, {
id:'12',
label: '二级 3-2',
children: [{
id:'13',
label: '三级 3-2-1'
}]
}]
}],
defaultProps: {
children: 'children',
label: 'label'
}
};
},
methods: {
handleNodeClick(data) {
console.log(data.id);
console.log("选择树");
}
}
};
var Ctor = Vue.extend(Main)
new Ctor().$mount('#app')
</script>